<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>个人中心</title>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/weChat/css/style.css"/>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/weChat/css/reset.css"/>
		
		<style type="text/css">
		</style>
	</head>
	<body>
		<div class="wrapper">
			<div class="header" style="position: relative;">
				<input type="file" id="fileId"  name="image" style="position: absolute; top: 0; width: 100%; height: 100px; opacity: 0;">
				<img class="icon_Head" src="<?php echo $user_info['avatar']?>"/>
				<img class="icon_rmore mar_left" src="__PUBLIC__/weChat/images/icon_more@2x.png"/>
			</div>
	        <div class="con_box font1">
                 <ul>
                 	<li class="b_btm nickName"><a href="<?php echo url('person/nickname')?>"><span class="li_sp1 font1">昵称</span><span class="li_sp2 font1"><?php echo $user_info['nickname']?></span>
						<img class="icon_rmore dis_in" src="__PUBLIC__/weChat/images/icon_more@2x.png"/></a></li>
                 	<li class="b_btm"><span class="li_sp1">绑定手机</span><span class="li_sp2 font4"><?php echo $user_info['username']?></span></li>
                 	<li> <a href="<?php echo url('person/password')?>"><span class="li_sp1">修改密码</span class="li_sp2"><span class="li_sp2"></span><img class="icon_rmore dis_in" src="__PUBLIC__/weChat/images/icon_more@2x.png"/></a></li>
                 </ul>
	        </div>
	        <div id="background1"></div>
	        <div id="content1">
	        	<div class="content1-line">
	        		<div class="content1-line-box">
	        			<input type="button"  class="select_inp b_btm" value="从相册中选择" />
	        		    <input type="button"  class="select_inp" value="拍照" />	
	        		</div>
	        		<input type="button" class="select_inp bor-rad" id="cancel" value="取消" />
	        	</div>

	        </div>
		</div>
		<script src="__PUBLIC__/weChat/js/jquery-2.2.2.js"></script>
		<script src="__PUBLIC__/home/js/ajaxfileupload.js"></script>

		<script type="text/javascript">			
			//$('.header').click(function(){$('#background1').show();$('#content1').show();});
			//$('#cancel').click(function(){$('#background1').hide();$('#content1').hide();});
			var flag=true;
			$("#fileId").change(function () {
				if(flag){
					flag=false;
					ajaxFileUpload();
				}
			});
			function ajaxFileUpload() {
				$.ajaxFileUpload({
							url: "<?php echo url('person/saveAvatar')?>", //用于文件上传的服务器端请求地址
							secureuri: false, //是否需要安全协议，一般设置为false
							fileElementId: 'fileId', //文件上传域的ID
							success: function (data){
								flag=true;
								var str = $(data).find("body").text();//获取返回的字符串
								var json = $.parseJSON(str);//把字符串转化为json对象
								if(json.code == 0){
									$(".icon_Head").attr('src',json.data);
								}else{
									alert(json.msg);
								}
							}
						}
				)
			};

		</script>
	</body>
</html>
